<template>
  <button @click="isShow=true">开</button>
  <button @click="isShow=false">关</button>
  <transition>
      <div v-if="isShow" class="gao">

      </div>
  </transition>
</template>

<script>
import { ref } from 'vue'
export default {
  setup () {
    const isShow = ref(false)
    return { isShow }
  }
}
</script>

<style scoped lang='less'>
.gao{background-color:greenyellow;width:200px;height:200px;}
.v-enter-from {
  opacity: 0;
}
.v-enter-active{
    transition: all 5s;
}
.v-enter-to {
   opacity: 1;
}

.v-leave-from {
  opacity: 1;
}
.v-leave-active{
    transition: all 5s;
}
.v-leave-to {
   opacity: 0;
}
</style>
